//
//  ST_MyAvatarMatchTipsView.swift
//  btvideo
//
//  Created by mac on 2020/3/23.
//  Copyright © 2020 JarvanZhang. All rights reserved.
//

import UIKit
import SnapKit
import SwifterSwift

class ST_MyAvatarMatchTipsView: UIView {
    
    static let size = CGSize.init(width: 325, height: 30)
    
    override init(frame: CGRect) {
        super.init(frame: frame)
        
        self.addSubview(sign_image_view)
        sign_image_view.snp.makeConstraints { (make) in
            make.centerY.equalToSuperview()
            make.left.equalToSuperview().offset(17)
        }
        
        self.addSubview(sign_label)
        sign_label.snp.makeConstraints { (make) in
            make.top.bottom.right.equalToSuperview()
            make.left.equalTo(sign_image_view.snp.right).offset(4)
        }
        
        self.cornerRadius = 15
        
        bindText()
    }
    
    
    fileprivate func bindText(){
        
        var str = tipsText
        
        if blue_color_style{
            str = blue_style_tips_text
        }
        
        let attrString = NSMutableAttributedString(string: str)
        let attr: [NSAttributedString.Key : Any] = [.font: UIFont.systemFont(ofSize: 12),.foregroundColor: UIColor(red: 1, green: 1, blue: 1, alpha: 1)]
        attrString.addAttributes(attr, range: NSRange(location: 0, length: attrString.length))
        sign_label.attributedText = attrString
        
        if blue_color_style{
            self.backgroundColor = Color.init(hex: 0x38CEDB, transparency: 0.8)
        }else{
            self.backgroundColor = Color.init(hex: 0xED3E58, transparency: 0.8)
        }
        
    }
    
    required init?(coder: NSCoder) {
        fatalError("init(coder:) has not been implemented")
    }
    
    fileprivate lazy var sign_label = UILabel()
    
    fileprivate lazy var sign_image_view:UIImageView = {
        let control = UIImageView()
        control.image = ST_ImageUtils.imageName("个人中心_icon_不符提示")
        return control
    }()
    
    var tipsText = "头像照片与你的真人识别不符，请更换其他本人照片"
    
    var blue_style_tips_text = "你的真人头像正在审核中，请耐心等待，马上就好"
    
    var blue_color_style = false{
        didSet{
            bindText()
        }
    }
    

}
